package com.rd.p2p.app.account;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;

import com.opensymphony.xwork2.ModelDriven;
import com.qdlc.p2p.biz.service.AccountLogService;
import com.qdlc.p2p.biz.web.action.BaseAction;
import com.qdlc.p2p.dal.common.model.jpa.PageDataList;
import com.qdlc.p2p.dal.dto.User;
import com.qdlc.p2p.dal.model.AccountLogModel;

public class AppAccountAction extends BaseAction<AccountLogModel> implements ModelDriven<AccountLogModel> {

	@Resource
	private AccountLogService accountLogService;

	private Map<String, Object> data;

	/**
	 * 我的资金记录
	 * 
	 * @return
	 */
	@Action("/app/account/logList")
	public void accLogList() throws Exception {
		User user = getSessionUser();
		if (user == null) {
			printWebResCodeAndMsgResult("-1","用户尚未登录!");
			return;
		}
		data = new HashMap<String, Object>();
		model.setUserId(user.getUserId());
		PageDataList<AccountLogModel> list = accountLogService.list(model);
		data.put("resCode", "1");
		data.put("data", list);
		printWebJson(getStringOfJpaObj(data));
	}

	/**
	 * 资金记录
	 * 
	 * @return
	 */
	@Action("/member/user/logList")
	public void logList() throws Exception {
	   this.accLogList();
	}

}
